home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
LIBRARY
/
DMTDEMOS
/
GETNEXT.DEM
< prev
next >
Wrap
Text File
|
1994-07-02
|
3KB
|
131 lines
program GetNextSample;
uses crt, DMT;
var
FileInfoBuffer : FileInfoStruct; { The FileInfoStruct data type is defined in the DMT unit }
FileSpec : string;
Fname : string[ 12 ];
Attributes,
Count : byte;
Hr,
Min,
Sec,
Month,
Day,
Year : word;
MatchFlag : boolean;
procedure DecodeDate( Date : word;
var
Month,
Day,
Year : word );
begin
Month := ( Date and $1E0 ) shr 5;
Day := Date and $1F;
Year := ( Date shr 9 ) + 1980;
end;
procedure DecodeTime( Time : word;
var
Hr,
Min,
Sec : word );
begin
Hr := Time shr 11;
Min := ( Time and $7E0 ) shr 5;
Sec := ( Time and $1f ) * 2;
end;
procedure DisplayFileInfo;
begin
Count := 1;
Fname := '';
with FileInfoBuffer do
begin
while ( FileNameExt[ Count ] <> #0 ) do
begin
Fname := Fname + FileNameExt[ Count ];
inc( Count );
end;
write( Fname :12 );
write( InsComma( FileSize ):12 );
DecodeTime( FileTime, Hr, Min, Sec );
write( ' ', Hr:2, ':', Min:2, ':', Sec:2 );
DecodeDate( FileDate, Month, Day, Year );
writeln( ' ', Month:2, '/', Day:2, '/', Year:2 );
end;
end;
begin
Color( 7, 0 );
clrscr;
SetDTA( seg( FileInfoBuffer ), ofs( FileInfoBuffer ) ); { Call SetDTA procedure }
writeln;
write('Enter file(s) to be searched : ');
readln( FileSpec );
if ( FileSpec = '' ) then
FileSpec := '*.*';
Attributes := 255; { Sets all available attributes }
GetFirst( FileSpec, Attributes ); { Call GetFirst procedure }
if ( ErrFlag ) then
begin
writeln( #7 );
writeln( ShowError( GetErrCode ) );
end
else
begin
clrscr;
writeln( ' File Name Size Time Date' );
window( 1, 3, 80, 25 );
DisplayFileInfo;
repeat
GetNext; { Call GetNext procedure }
if ( ErrFlag ) then
begin
writeln;
writeln( 'End of the directory listing...' );
end
else
begin
DisplayFileInfo;
if ( wherey = 21 ) then
begin
writeln( #13#10, ' --- More ---' );
readln;
clrscr;
end;
end
until ( ErrFlag = true );
end;
GetEnter;
end.